//
//  TSWebView.m
//  Pods-TSWebKit_Example
//
//  Created by Zac on 2020/10/27.
//

#import "TSWebView.h"

@implementation TSWebView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]){
    }
    return self;
}

- (WKNavigation *)loadRequest:(NSURLRequest *)request {
    return [self loadRequest:request additionHeader:self.additionHeader];
}


- (WKNavigation *)loadRequest:(NSURLRequest *)request additionHeader:(NSDictionary *)additionHeader {
    NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:request.URL];
    for (NSString *key in additionHeader.allKeys) {
        NSString *value = additionHeader[key];
        [urlRequest setValue:value forHTTPHeaderField:key];
    }
    return [super loadRequest:urlRequest];
}

@end
